
function scaleContent() {

  const windowWidth = window.innerWidth;
  const windowHeight = window.innerHeight;
  const targetWidth = 1100;
  const targetHeight = 550;
  const targetAspectRatio = targetWidth / targetHeight;
  const currentAspectRatio = windowWidth / windowHeight;

  let scale;

  // 根据窗口宽高比选择缩放基准
  if (currentAspectRatio > targetAspectRatio) {
      scale = windowHeight / targetHeight; // 按高度缩放
  } else {
      scale = windowWidth / targetWidth; // 按宽度缩放
  }
  const inputElement = document.querySelector('#input');
  inputElement.style.transform = `translate(-50%, -50%) scale(${scale})`;
}

// 初始加载时缩放
scaleContent();

// 监听窗口大小变化，实时缩放
window.addEventListener('resize', scaleContent);